package org.dromara.tearoom.domain.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;
import org.dromara.common.core.enums.ArrayValuable;

import java.util.Arrays;

/**
 * IoT 设备操作类型
 *
 * @author ckj
 */
@AllArgsConstructor
@Getter
public enum IotDeviceOperTypeEnum implements ArrayValuable<String> {

    OPERA_KEY("1", "开关闸"),
    SET_WIFI_LOCK("2", "设置WIFI锁"),
    SET_KEY_LOCK("3", "设置开关闸锁"),
    GET_INFO("4", "获取设备状态");

    /**
     * 类型
     */
    private final String type;

    /**
     * 描述
     */
    private final String description;

    public static final String[] ARRAYS = Arrays.stream(values()).map(IotDeviceOperTypeEnum::getType).toArray(String[]::new);

    @Override
    public String[] array() {
        return ARRAYS;
    }

    /**
     * 判断是否是开关闸
     *
     * @param type 类型
     * @return 判断是否是开关闸
     */
    public static boolean isOperaKey(Integer type) {
        return OPERA_KEY.getType().equals(type);
    }



}
